Skip to content

fix(interpreter): preserve shopt options across exec() calls#1131

Merged
chaliy merged 2 commits intomainfrom
fix/issue-1130-alias-expansion
Apr 6, 2026
Merged

fix(interpreter): preserve shopt options across exec() calls#1131
chaliy merged 2 commits intomainfrom
fix/issue-1130-alias-expansion

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 6, 2026

Summary

  • reset_transient_state() was wiping ALL SHOPT_* variables between exec() calls, including shopt options like expand_aliases. This made alias expansion impossible when shopt and alias commands were in separate exec() calls (the JS/Python API pattern).
  • Now only set options (SHOPT_e, SHOPT_x, etc.) are reset between exec() calls for safety (TM-ISO-023), while shopt options (expand_aliases, extglob, dotglob, etc.) persist as session configuration.

Test plan

  • New test alias_expansion_persists_across_exec_calls verifies aliases work across separate exec() calls
  • Existing set_e_does_not_leak_between_exec confirms set -e is still properly reset
  • Existing threat_isolation_alias_isolation confirms cross-session alias isolation
  • Snapshot roundtrip tests updated and passing
  • All 167 threat model + security + snapshot tests pass

Closes #1130

chaliy added 2 commits April 6, 2026 22:15
reset_transient_state() was wiping ALL SHOPT_* variables between
exec() calls, including shopt options like expand_aliases. This
made alias expansion impossible when shopt and alias commands were
in separate exec() calls (the JS/Python API pattern).

Now only `set` options (SHOPT_e, SHOPT_x, etc.) are reset between
exec() calls for safety (TM-ISO-023), while `shopt` options
(expand_aliases, extglob, dotglob, etc.) persist as session config.

Closes #1130
set options are now properly cleared between exec() calls via
SET_OPTION_VARS in reset_transient_state().
@chaliy chaliy merged commit 838b87b into main Apr 6, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-1130-alias-expansion branch April 6, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(js): alias expansion broken — aliases defined but not resolved at execution

1 participant